home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Table / Include / TblLink.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  7.2 KB  |  226 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                TblLink.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef TBLLINK_H
  13. #define TBLLINK_H
  14.  
  15. // for CCell
  16. #ifndef TBLPART_H
  17. #include "TblPart.h"
  18. #endif
  19.  
  20. // ----- Framework Layer -----
  21.  
  22. #ifndef FWLINK_H
  23. #include "FWLink.h"
  24. #endif
  25.  
  26. #ifndef FWLNKMGR_H
  27. #include "FWLnkMgr.h"
  28. #endif
  29.  
  30. #ifndef FWPOINT_H
  31. #include "FWPoint.h"
  32. #endif
  33.  
  34. //========================================================================================
  35. //    Forward Declarations
  36. //========================================================================================
  37.  
  38. class FW_CLASS_ATTR CTablePart;
  39. class FW_CLASS_ATTR FW_CPart;
  40. class FW_CLASS_ATTR FW_CPresentation;
  41. class FW_CLASS_ATTR CTableSelection;
  42. class FW_CLASS_ATTR FW_CFrame;
  43. class FW_CLASS_ATTR ODPart;
  44. class FW_CLASS_ATTR ODDraft;
  45. class FW_CLASS_ATTR CBreakLinkSourceCommand;
  46. class FW_CLASS_ATTR CBreakLinkCommand;
  47.  
  48. extern const ODPropertyName kODPropSourceLink;
  49. extern const ODPropertyName kODPropDestLink;
  50. extern const ODValueType kTableLinkValue;
  51.  
  52. //========================================================================================
  53. //    class CTablePublishLink
  54. //========================================================================================
  55.  
  56. class FW_CLASS_ATTR CTablePublishLink : public FW_CPublishLink
  57. {
  58.   public:
  59.     FW_DECLARE_CLASS
  60.  
  61.     CTablePublishLink(Environment* ev, 
  62.                       ODUpdateID changeID, 
  63.                       FW_CPresentation* presentation,
  64.                       CTablePart* part,
  65.                       CTableSelection* selection);
  66.     virtual ~ CTablePublishLink();
  67.  
  68.     //--- Inherited from FW_CPublishLink
  69.     virtual void        Publish(Environment* ev);    // Override
  70.     virtual void        ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU);    // Override
  71.  
  72.     virtual void        BreakLink(Environment* ev);    // Override
  73.  
  74.     //--- Could move to FW_CPublishLink
  75.     virtual CBreakLinkSourceCommand* DoLinkInfo(Environment *ev, ODFacet* facet);
  76.     virtual void        Externalize(Environment* ev, ODStorageUnit* storageUnit,
  77.                                     FW_CCloneInfo* cloneInfo);
  78.  
  79. //--- Will move to FW_CPublishLink
  80.     virtual FW_CFrame*    GetFrameToRevealLink(Environment* ev);
  81.     virtual void        DoSelect(Environment* ev, FW_CFrame* frame);
  82.  
  83.     FW_Boolean            HasEmbeddedFrame(Environment* ev, ODFrame* odFrame);
  84.  
  85.     //--- Specific to Table part
  86.     CCell                GetCell(Environment* ev) const
  87.                             { return fLinkCell; };
  88.     void                SetCell(Environment* ev, const CCell& cell)
  89.                             { fLinkCell = cell; };
  90.  
  91.   private:
  92.     CTablePart*            fTablePart;
  93.     CTableSelection*    fTableSelection;
  94.     CCell                fLinkCell;        // cell of the source link
  95. };
  96.  
  97. //========================================================================================
  98. //    class CTableSubscribeLink
  99. //========================================================================================
  100.  
  101. class FW_CLASS_ATTR CTableSubscribeLink : public FW_CSubscribeLink
  102. {
  103.   public:
  104.     FW_DECLARE_CLASS
  105.  
  106.     CTableSubscribeLink(Environment* ev, 
  107.                         ODLink* odLink, 
  108.                         ODLinkInfo* linkInfo, 
  109.                         FW_CPresentation* presentation,
  110.                         CTablePart* part,
  111.                         CTableSelection* destSelection);
  112.     virtual ~ CTableSubscribeLink();
  113.  
  114.     //--- FW_CSubscribeLink overrides
  115.     virtual void        Subscribe(Environment* ev);    // Override
  116.     virtual void        DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU);
  117.  
  118.     virtual void        BreakLink(Environment* ev);    // Override
  119.  
  120.     //--- Could move to FW_CSubscribeLink
  121.     FW_CPresentation*    GetPresentation(Environment* ev);
  122.     virtual CBreakLinkCommand* DoLinkInfo(Environment* ev, ODFacet* facet);
  123.     virtual void        Externalize(Environment* ev, ODStorageUnit* storageUnit,
  124.                                     FW_CCloneInfo* cloneInfo);
  125.  
  126.     //--- Specific to Table part
  127.     CCell                GetCell(Environment* ev) const
  128.                             { return fLinkCell; };
  129.     void                SetCell(Environment* ev, const CCell& cell)
  130.                             { fLinkCell = cell; };
  131.  
  132.   private:
  133.     CTablePart*            fTablePart;
  134.     CTableSelection*    fTableSelection;
  135.     CCell                fLinkCell;        // cell of the destination link
  136. };
  137.  
  138. //========================================================================================
  139. // CTableSubscribeLink Inlines
  140. //========================================================================================
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    CTableSubscribeLink::GetPresentation
  144. //----------------------------------------------------------------------------------------
  145. inline FW_CPresentation* CTableSubscribeLink::GetPresentation(Environment* ev)
  146. {
  147.     return fPresentation;
  148. }
  149.  
  150. //========================================================================================
  151. //    class CTableLinkManager
  152. //========================================================================================
  153.  
  154. class FW_CLASS_ATTR CTableLinkManager : public FW_CLinkManager
  155. {
  156.   public:
  157.     FW_DECLARE_CLASS
  158.  
  159. //----------------------------------------------------------------------------------------
  160. //    Constructors/Destructors
  161. //
  162.   public:
  163.     CTableLinkManager(Environment* ev, CTablePart* thePart);
  164.     virtual ~CTableLinkManager();
  165.  
  166. //----------------------------------------------------------------------------------------
  167. //    Override Methods
  168. //
  169.   public:
  170.     virtual FW_CPublishLink*     NewPublishLink(Environment* ev, 
  171.                                                ODUpdateID updateID, 
  172.                                                FW_CPresentation* presentation);
  173.     virtual FW_CSubscribeLink*    NewSubscribeLink(Environment* ev, 
  174.                                                  ODLink* odLink,
  175.                                                  ODLinkInfo* linkInfo,
  176.                                                  FW_CPresentation* presentation);
  177.  
  178.     virtual void            DoChangeLinkStatus(Environment* ev, ODFrame* odFrame);
  179.                                 // formerly named LinkStatusChanged
  180.  
  181.     virtual void            DoUpdateLinks(Environment* ev,
  182.                                           ODFrame* odEmbeddedFrame,
  183.                                           ODUpdateID updateID);
  184.                                 // formerly named EmbeddedFrameUpdated
  185.  
  186.     virtual void            RevealLink(Environment* ev, ODLinkSource* linkSource);
  187.  
  188. //----------------------------------------------------------------------------------------
  189. //    New API
  190. //
  191.   public:
  192.     void                    BreakExistingLinks(Environment* ev, const CCell& cell);
  193.     void                    MoveExistingLinks(Environment* ev,
  194.                                               const CCell& fromCell,
  195.                                               const CCell& toCell);
  196.  
  197.     void                    ExternalizeLinks(Environment* ev, ODStorageUnitView* suView,
  198.                                              FW_CCloneInfo* cloneInfo);
  199.     void                    InternalizeLinks(Environment* ev, ODStorageUnit* storageUnit);
  200.  
  201.     CTablePublishLink*        CellToPublishLink(Environment* ev, const CCell& cell) const;
  202.     CTableSubscribeLink*    CellToSubscribeLink(Environment* ev, const CCell& cell) const;
  203.  
  204.     CTablePublishLink*         GetSelectedLinkSource(Environment* ev);
  205.     CTableSubscribeLink*     GetSelectedLinkDest(Environment* ev);
  206.  
  207.     void                    RegisterSubscribers(Environment* ev);
  208.     FW_Boolean                ShowLinkInfo(Environment* ev, ODFacet* facet);
  209.  
  210.     void                    UpdateLinkSource(Environment* ev, ODUpdateID updateID);
  211.  
  212.   private:
  213.     FW_Boolean                IsCellInLink(Environment* ev, const CCell& cell);
  214.  
  215.     void        InternalizeOneSourceLink(Environment* ev, ODStorageUnitView* suView, ODDraft* suDraft);
  216.     void        InternalizeOneDestLink(Environment* ev, ODStorageUnitView* suView, ODDraft* suDraft);
  217.  
  218. //----------------------------------------------------------------------------------------
  219. //    Data Members
  220. //
  221.   private:
  222.     CTablePart*        fTablePart;
  223. };
  224.  
  225.  
  226. #endif